
import 'dart:ui';

import 'package:bubble_tab_indicator/bubble_tab_indicator.dart';
import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:tab_indicator_styler/tab_indicator_styler.dart';

import 'action.dart';
import 'state.dart';

final tabsLeft = ['全部', '淘宝', '天猫', '京东', '拼多多', '苏宁', '唯品会', '其他'];
final tabsCenter = [
  '全部',
  '淘宝',
  '京东',
  '拼多多',
  '唯品会',
];
final tabsRight = [
  '每日签到',
];

Widget buildView(FindState state, Dispatch dispatch, ViewService viewService) {
  final tabs = ['线报', '每日爆款', '宣传素材'];
  return Container(
      margin: EdgeInsets.only(top: 44),
      color: Colors.white,
      child: DefaultTabController(
        length: 3,
        child: Column(
          children: [
            Container(
                // height: 44,
                padding: EdgeInsets.symmetric(horizontal: 15),
                child: Row(
                  children: [
                    Image.asset(
                      'assets/images/found_module/found_zc.png',
                      width: 16,
                      height: 16,
                    ),
                    Expanded(
                        child: TabBar(
                      labelColor: Color.fromRGBO(255, 37, 38, 1),
                      labelStyle: TextStyle(fontSize: 15),
                      unselectedLabelColor: Color.fromRGBO(47, 47, 47, 1),
                      unselectedLabelStyle: TextStyle(fontSize: 15),
                      tabs: tabs.map((e) => Tab(text: e)).toList(),
                      indicator: MaterialIndicator(
                        color: Color.fromRGBO(255, 37, 38, 1),
                        height: 3,
                        topLeftRadius: 4,
                        topRightRadius: 4,
                        bottomLeftRadius: 4,
                        bottomRightRadius: 4,
                        horizontalPadding: 45,
                        tabPosition: TabPosition.bottom,
                      ),
                    )),
                    Image.asset(
                      'assets/images/found_module/found_ss.png',
                      width: 16,
                      height: 16,
                    ),
                  ],
                )),
            Expanded(
                child: TabBarView(physics: NeverScrollableScrollPhysics(),
                    //DefaultTabController解决左右滑动
                    children: [
                  _itemLeft(state, dispatch, viewService),
                  _itemCenter(state, dispatch, viewService),
                  _itemRight(state, dispatch, viewService)
                ]))
          ],
        ),
      ));
}

///线报
_itemLeft(FindState state, Dispatch dispatch, ViewService viewService) {
  return Container(
      color: Color.fromRGBO(250, 250, 254, 1),
      child: Column(
        children: [
          Container(
            color: Colors.white,
            width: MediaQuery.of(viewService.context).size.width,
            padding: EdgeInsets.only(top: 10, left: 15, right: 15),
            child: Wrap(
              spacing: 8,
              runSpacing: 10,
              children: tabsLeft
                  .asMap()
                  .map(
                    (index, value) {
                      bool isSelect = index == state.selectIndex;
                      print('正常事件$index');
                      return MapEntry(
                          index,
                          InkWell(
                              onTap: () {
                                print('点击事件为$index');
                                dispatch(FindActionCreator.updateSelect(index));
                              },
                              child: Container(
                                height: 26,
                                padding: EdgeInsets.fromLTRB(15, 2, 15, 2),
                                decoration: BoxDecoration(
                                  color: isSelect
                                      ? Color.fromRGBO(255, 37, 38, 1)
                                      : Color.fromRGBO(248, 248, 248, 1),
                                  borderRadius: BorderRadius.circular(26),
                                ),
                                child: Text(value,
                                    style: TextStyle(
                                        color: isSelect
                                            ? Colors.white
                                            : Color.fromRGBO(119, 119, 119, 1),
                                        fontSize: 15)),
                              )));
                    },
                  )
                  .values
                  .toList(),
            ),
          ),
          Expanded(
              child: ListView.builder(
            padding: EdgeInsets.only(top: 0),
            shrinkWrap: true,
            itemCount: 4,
            itemBuilder: (BuildContext context, int index) {
              return _leftList(index);
            },
          ))
        ],
      ));
}

_leftList(int index) {
  return Container(
    margin: EdgeInsets.only(left: 15, right: 15, top: 10),
    padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
    decoration: BoxDecoration(
      borderRadius: BorderRadius.all(Radius.circular(8)),
      color: Colors.white,
    ),
    child: Column(
      children: [
        Row(
          children: [
            Text('每日线报',
                style: TextStyle(
                    color: Color.fromRGBO(62, 61, 72, 1), fontSize: 16)),
            SizedBox(
              width: 8,
            ),
            Expanded(
              child: Text('2021-6-5 16:40:20',
                  style: TextStyle(
                      color: Color.fromRGBO(119, 119, 121, 1), fontSize: 11)),
            )
          ],
        ),
        SizedBox(
          height: 10,
        ),
       _middle(index),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Expanded(
                child: _leftBottom(
              "assets/images/found_module/found_bc.png",
              "保存图片",
            )),
            Container(
              width: 0.5,
              height: 1,
              color: Color.fromRGBO(226, 226, 226, 1),
            ),
            Expanded(
                child: _leftBottom(
              "assets/images/found_module/found_fzwa.png",
              "复制文案",
            )),
            Container(
              width: 0.5,
              height: 1,
              color: Color.fromRGBO(226, 226, 226, 1),
            ),
            Expanded(
                child: _leftBottom(
              "assets/images/found_module/found_yjfq.png",
              "一键发圈",
            )),
          ],
        )
      ],
    ),
  );
}
 _middle(int index){
  List add;
  bool type;
  if(index == 0){
    add = [{
      'img': false,
    }];
    type = true;
  }
  if(index == 1){
    add = [{
      'img': false,
    },{
      'img': false,
    }];
    type = false;
  }
  if(index == 2){
    add = [{
      'img': true,
    }];
    type = true;
  }
  if(index == 3){
    add = [{
      'img': false,
    },{
      'img': false,
    },{
      'img': true,
    }];
    type = false;
  }

  return Column(
    children:add.asMap().map((index, value) {
    return MapEntry(index, _imgAndTitle(index, type,value['img'] ),);
  }).values
      .toList(),);
}
Widget _imgAndTitle(int index, bool offstage1, bool offstage2) {
  return Container(
    margin: EdgeInsets.only(bottom: 10),
    child: Column(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: [
      Offstage(
        offstage: offstage1,
        child: Text('第${index + 1}步分享',
            style:
                TextStyle(color: Color.fromRGBO(62, 61, 72, 1), fontSize: 15)),
      ),
      Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Expanded(
              //这里保证
              child: Container(
            padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.all(Radius.circular(8)),
              color: Color.fromRGBO(249, 250, 250, 1),
            ),
            child: _leftTitle(),
          ),
          ),
          Offstage(
              offstage: offstage2,
              child: Container(
                  margin: EdgeInsets.only(left: 12),
                  child: ClipRRect(
                    borderRadius: BorderRadius.circular(6),
                    child: Image.network(
                      'https://img.alicdn.com/bao/uploaded/i2/2206686532409/O1CN01sSkXLn1TfMnzUYG2W_!!2206686532409-2-picassoopen.png',
                      width: 100,
                      height: 100,
                    ),
                  )))
        ],
      )
    ],
  ),);
}

_leftTitle() {
  List customList = [
    'https://u.jd.com/8o6bmLt',
    'https://u.jd.com/8k6OTSS',
    'https://u.jd.com/8t6678a'
  ];
  String content =
      '光明 优加纯牛奶250ml*16盒/礼盒装 中华老字号光明 优加纯牛奶250ml*16盒/礼盒装 中华老字号\nhttps://u.jd.com/8o6bmLt \n下单1件到手单价仅需34.9元\n"好价-239-120券\nhttps://u.jd.com/8k6OTSS \n鸡蛋8折了，专区39.9的选6件71.5元\nhttps://u.jd.com/8t6678a';
  List<Widget> contentItem = [];
  int count = 0;
  customList.forEach((element) {
    content = content.replaceAll(element, "去购买>");
  });
  List contentList = content.split('\n');
  contentList.forEach((element) {
    Color color;
    String url;
    if (element.contains('去购买>')) {
      if (count < customList.length) {
        url = customList[count];
      } else {
        url = '';
      }
      color = Color.fromRGBO(255, 37, 38, 1);
      count += 1;
    } else {
      color = Color.fromRGBO(62, 61, 72, 1);
      url = '';
    }
    print('url====$url');
    contentItem.add(_item(element, color, url));
  });
  return Column(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: contentItem,
  );
}

 _item(String title, Color color, String url) {
  return InkWell(
    onTap: () {
      if (url.isEmpty) {
      } else {
        print("跳转到用户协议...$url");
      }
    },
    child: Text(
      title,
      style: TextStyle(color: color, fontSize: 13),
      maxLines: 10,
    ),
  );
}
_leftBottom(String img, String title) {
  return InkWell(
    onTap: () {},
    child: Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Image.asset(
          img,
          width: 13,
          color: Color.fromRGBO(62, 61, 72, 1),
        ),
        SizedBox(width: 5),
        Text(
          title,
          style: TextStyle(
            fontSize: 12,
            color: Color.fromRGBO(62, 61, 72, 1),
          ),
        ),
      ],
    ),
  );
}

///每日爆款
_itemCenter(FindState state, Dispatch dispatch, ViewService viewService) {
  return Container(
    color: Color.fromRGBO(250, 250, 254, 1),
    child: DefaultTabController(
      length: tabsCenter.length,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
              color: Colors.white,
              width: MediaQuery.of(viewService.context).size.width,
              padding: EdgeInsets.only(
                left: 10,
                right: 10,
                top: 6,
              ),
              child: TabBar(
                isScrollable: true,
                //用DefaultTabController解决从左对齐
                labelColor: Color.fromRGBO(255, 255, 255, 1),
                labelStyle: TextStyle(fontSize: 14),
                unselectedLabelColor: Color.fromRGBO(119, 119, 121, 1),
                unselectedLabelStyle: TextStyle(fontSize: 14),
                tabs: tabsCenter.map((e) => Tab(text: e)).toList(),
                indicator: BubbleTabIndicator(
                  indicatorHeight: 25.0,
                  indicatorColor: Color.fromRGBO(255, 37, 38, 1),
                  tabBarIndicatorSize: TabBarIndicatorSize.tab,
                  insets: const EdgeInsets.symmetric(horizontal: 1),
                ),
              )),
          Expanded(
            child: TabBarView(
              children: tabsCenter.map((e) {
                return ListView.builder(
                  padding: EdgeInsets.only(top: 0),
                  shrinkWrap: true,
                  itemCount: 3,
                  itemBuilder: (BuildContext context, int index) {
                    return _centerList(index);
                  },
                );
              }).toList(),
            ),
          ),
        ],
      ),
    ),
  );
}

_centerList(int index) {
  int countImg;
  List imgList;
  int row;
  double ratio;
  if (index == 0) {
    countImg = 1;
  }
  if (index == 1) {
    countImg = 2;
  }
  if (index == 2) {
    countImg = 4;
  }
  if (countImg == 1) {
    imgList = [
      'https://img14.360buyimg.com/pop/jfs/t1/190146/6/4241/594967/60a71fbaEccd70982/fef46ccaaeecf9de.png'
    ];
    row = 1;
    ratio = 1;
  }
  if (countImg == 2) {
    row = 2;
    ratio = 1;
    imgList = [
      "https://img.gzzhitu.com/zhitu-api/1622894340675195.jpg",
      "https://img.gzzhitu.com/zhitu-api/1622894340689970.jpg"
    ];
  }
  if (countImg == 4) {
    row = 3;
    ratio = 1;
    imgList = [
      "https://img.gzzhitu.com/zhitu-api/1622894340690701.jpg",
      "https://img.alicdn.com/i2/1880087221/O1CN01IJAyP023DGf93Pt9D_!!1880087221.jpg",
      "https://img.alicdn.com/i1/1880087221/O1CN01QxTwG323DGZdjc6p0_!!1880087221.jpg",
      "https://img-haodanku-com.cdn.fudaiapp.com/cc84e86082b70b10df42b2c22f04d0a5.png"
    ];
  }
  return Container(
    margin: EdgeInsets.only(left: 15, right: 15, top: 10),
    padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
    decoration: BoxDecoration(
      borderRadius: BorderRadius.all(Radius.circular(8)),
      color: Colors.white,
    ),
    child: Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            ClipRRect(
              borderRadius: BorderRadius.circular(36),
              child: Image.network(
                'https://img.alicdn.com/bao/uploaded/i1/389649927/O1CN016KZY2H2NCcQR8JxMw_!!389649927.jpg',
                width: 36,
                height: 36,
                fit: BoxFit.cover,
              ),
            ),
            SizedBox(
              width: 11,
            ),
            Expanded(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Row(
                        children: [
                          Text(
                            '小型风扇迷你可充电随身携带',
                            style: TextStyle(
                              color: Color.fromRGBO(62, 61, 72, 1),
                              fontSize: 13,
                            ),
                          ),
                          SizedBox(
                            width: 7,
                          ),
                          InkWell(
                            onTap: () {},
                            child: Image.asset(
                              'assets/images/found_module/found_wzc.png',
                              width: 46,
                              height: 19,
                            ),
                          ),
                        ],
                      ),
                      GestureDetector(
                        onTap: () {},
                        child: Container(
                          height: 18,
                          padding: EdgeInsets.symmetric(horizontal: 7),
                          decoration: BoxDecoration(
                            borderRadius: BorderRadius.all(Radius.circular(18)),
                            color: Colors.red,
                          ),
                          child: Row(
                            children: [
                              Image.asset(
                                'assets/images/found_module/found_fx.png',
                                width: 10,
                                height: 10,
                              ),
                              SizedBox(
                                width: 3,
                              ),
                              Text(
                                "10",
                                style: TextStyle(
                                    color: Color.fromRGBO(255, 255, 255, 1),
                                    fontSize: 12),
                              ),
                            ],
                          ),
                        ),
                      ),
                    ],
                  ),
                  SizedBox(
                    height: 3,
                  ),
                  Text(
                    '2021-06-07 14:30:02',
                    style: TextStyle(
                      color: Color.fromRGBO(62, 61, 72, 1),
                      fontSize: 11,
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
        Container(
          margin: EdgeInsets.only(top: 11),
          child: Text.rich(
            TextSpan(
              style: TextStyle(
                fontSize: 13,
                color: Color.fromRGBO(106, 106, 106, 1),
              ),
              text: '小型风扇迷你可充电随身携带\r\n劵后👉9.9\r\n夏日必备好物推荐✨3档风速\r\nUSB充电❤全天候清凉',
            ),
          ),
        ),
        Row(
          mainAxisAlignment: MainAxisAlignment.end,
          children: [
            Text(
              "1111种草",
              style: TextStyle(
                fontSize: 13,
                color: Color.fromRGBO(106, 106, 106, 1),
              ),
            ),
          ],
        ),
        SizedBox(
          height: 10,
        ),
        Offstage(
          offstage: false,
          child: GestureDetector(
            onTap: () {},
            child: Container(
              height: 120,
              alignment: Alignment.center,
              child: Stack(
                alignment: AlignmentDirectional.center,
                children: [
                  ClipRRect(
                      borderRadius: BorderRadius.circular(6),
                      child: Image.network(
                        'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwx1.sinaimg.cn%2Flarge%2F008fHVgdly4gqfhftvhl5j30u00iv40g.jpg&refer=http%3A%2F%2Fwx1.sinaimg.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1625715989&t=c434eaa9895585d7f7cd2f27ff34acf8',
                        fit: BoxFit.cover,
                        width: window.physicalSize.width - 50,
                      ),
                  ),
                  Image.asset(
                    "assets/images/found_module/found_play.png",
                    width: 30,
                    height: 30,
                  ),
                ],
              ),
            ),
          ),
        ),
        SizedBox(
          height: 5,
        ),
        GridView.count(
          shrinkWrap: true,
          padding: EdgeInsets.only(top: 0),
          crossAxisCount: row,
          mainAxisSpacing: 5,
          crossAxisSpacing: 5,
          childAspectRatio: ratio,
          physics: NeverScrollableScrollPhysics(),
          children: imgList
              .asMap()
              .map(
                (index, value) {
                  return countImg == 1
                      ? MapEntry(
                          index,
                          GestureDetector(
                            onTap: () {},
                            child: ClipRRect(
                              borderRadius: BorderRadius.circular(6),
                              child: Image.network(
                                value,
                                fit: BoxFit.fitHeight,
                                alignment: Alignment.centerLeft,
                              ),
                            ),
                          ),
                        )
                      : MapEntry(
                          index,
                          GestureDetector(
                            onTap: () {},
                            child: ClipRRect(
                              borderRadius: BorderRadius.circular(6),
                              child: Image.network(
                                value,
                                fit: BoxFit.cover,
                              ),
                            ),
                          ),
                        );
                },
              )
              .values
              .toList(),
        ),
        SizedBox(
          height: 8,
        ),
        Offstage(
          offstage: false,
          child: Container(
            padding: EdgeInsets.symmetric(horizontal: 7, vertical: 7),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.all(Radius.circular(8)),
              color: Color.fromRGBO(249, 249, 249, 1),
            ),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                ClipRRect(
                  borderRadius: BorderRadius.circular(8),
                  child: Image.network(
                    'https://img.alicdn.com/bao/uploaded/i1/389649927/O1CN016KZY2H2NCcQR8JxMw_!!389649927.jpg',
                    width: 78,
                    height: 78,
                    fit: BoxFit.cover,
                  ),
                ),
                SizedBox(
                  width: 11,
                ),
                Expanded(
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Container(
                        child: Row(
                          children: [
                            Image.asset(
                              'assets/images/public_module/public_shop_icon_jd.png',
                              width: 11,
                              height: 11,
                            ),
                            SizedBox(
                              width: 5,
                            ),
                            Expanded(
                              child: Text(
                                "A4塑封膜10丝透明照片a4过塑膜7A4塑封膜10丝透明照片a4过塑膜",
                                style: TextStyle(
                                  fontSize: 12,
                                  color: Color.fromRGBO(62, 61, 72, 1),
                                ),
                                overflow: TextOverflow.ellipsis,
                                maxLines: 1,
                              ),
                            )
                          ],
                        ),
                      ),
                      SizedBox(
                        height: 8,
                      ),
                      Container(
                        padding: EdgeInsets.symmetric(vertical: 4),
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.all(Radius.circular(8)),
                          color: Colors.white,
                        ),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Expanded(
                                child: Column(
                              children: [
                                Text.rich(
                                  TextSpan(
                                    children: [
                                      TextSpan(
                                        text: "￥",
                                        style: TextStyle(
                                          fontSize: 13,
                                          color: Color.fromRGBO(255, 37, 38, 1),
                                        ),
                                      ),
                                      TextSpan(
                                        text: "19.9",
                                        style: TextStyle(
                                          fontSize: 14,
                                          fontWeight: FontWeight.bold,
                                          color: Color.fromRGBO(255, 37, 38, 1),
                                        ),
                                      ),
                                    ],
                                  ),
                                ),
                                Text(
                                  "到手价",
                                  style: TextStyle(
                                    fontSize: 10,
                                    color: Color.fromRGBO(62, 61, 72, 1),
                                  ),
                                ),
                              ],
                            )),
                            Expanded(
                                child: Column(
                              children: [
                                Text.rich(
                                  TextSpan(
                                    children: [
                                      TextSpan(
                                        text: "￥",
                                        style: TextStyle(
                                          fontSize: 13,
                                          color: Color.fromRGBO(255, 37, 38, 1),
                                        ),
                                      ),
                                      TextSpan(
                                        text: "1.9",
                                        style: TextStyle(
                                          fontSize: 14,
                                          fontWeight: FontWeight.bold,
                                          color: Color.fromRGBO(255, 37, 38, 1),
                                        ),
                                      ),
                                    ],
                                  ),
                                ),
                                Text(
                                  "预估收益",
                                  style: TextStyle(
                                    fontSize: 10,
                                    color: Color.fromRGBO(62, 61, 72, 1),
                                  ),
                                ),
                              ],
                            )),
                            GestureDetector(
                              onTap: () {},
                              child: Image.asset(
                                  "assets/images/found_module/found_ljgm.png",
                                  height: 45),
                            ),
                          ],
                        ),
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ),
        ),
        SizedBox(
          height: 15,
        ),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Expanded(
                child: _leftBottom(
              "assets/images/found_module/found_bc.png",
              "保存图片",
            )),
            Container(
              width: 0.5,
              height: 1,
              color: Color.fromRGBO(226, 226, 226, 1),
            ),
            Expanded(
                child: _leftBottom(
              "assets/images/found_module/found_fzwa.png",
              "复制文案",
            )),
            Container(
              width: 0.5,
              height: 1,
              color: Color.fromRGBO(226, 226, 226, 1),
            ),
            Expanded(
                child: _leftBottom(
              "assets/images/found_module/found_yjfq.png",
              "一键发圈",
            )),
          ],
        ),
      ],
    ),
  );
}

///宣传素材
_itemRight(FindState state, Dispatch dispatch, ViewService viewService) {
  return Container(
    color: Color.fromRGBO(250, 250, 254, 1),
    child: DefaultTabController(
      length: tabsRight.length,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
              color: Colors.white,
              width: MediaQuery.of(viewService.context).size.width,
              padding: EdgeInsets.only(
                left: 10,
                right: 10,
                top: 6,
              ),
              child: TabBar(
                isScrollable: true,
                //用DefaultTabController解决从左对齐
                labelColor: Color.fromRGBO(255, 255, 255, 1),
                labelStyle: TextStyle(fontSize: 14),
                unselectedLabelColor: Color.fromRGBO(119, 119, 121, 1),
                unselectedLabelStyle: TextStyle(fontSize: 14),
                tabs: tabsRight.map((e) => Tab(text: e)).toList(),
                indicator: BubbleTabIndicator(
                  indicatorHeight: 25.0,
                  indicatorColor: Color.fromRGBO(255, 37, 38, 1),
                  tabBarIndicatorSize: TabBarIndicatorSize.tab,
                  insets: const EdgeInsets.symmetric(horizontal: 1),
                ),
              )),
          Expanded(
            child: TabBarView(
              children: tabsRight.map((e) {
                return ListView.builder(
                  padding: EdgeInsets.only(top: 0),
                  shrinkWrap: true,
                  itemCount: 10,
                  itemBuilder: (BuildContext context, int index) {
                    return _rightList(index);
                  },
                );
              }).toList(),
            ),
          ),
        ],
      ),
    ),
  );
}

_rightList(int index) {
  return Container(
    margin: EdgeInsets.only(left: 15, right: 15, top: 10),
    padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
    decoration: BoxDecoration(
      borderRadius: BorderRadius.all(Radius.circular(8)),
      color: Colors.white,
    ),
    child: Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            ClipRRect(
              borderRadius: BorderRadius.circular(36),
              child: Image.network(
                'https://img.alicdn.com/bao/uploaded/i1/389649927/O1CN016KZY2H2NCcQR8JxMw_!!389649927.jpg',
                width: 36,
                height: 36,
                fit: BoxFit.cover,
              ),
            ),
            SizedBox(
              width: 11,
            ),
            Expanded(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Row(
                        children: [
                          Text(
                            '小型风扇迷你可充电随身携带',
                            style: TextStyle(
                              color: Color.fromRGBO(62, 61, 72, 1),
                              fontSize: 13,
                            ),
                          ),
                          SizedBox(
                            width: 7,
                          ),
                          InkWell(
                            onTap: () {},
                            child: Image.asset(
                              'assets/images/found_module/found_wzc.png',
                              width: 46,
                              height: 19,
                            ),
                          ),
                        ],
                      ),
                      GestureDetector(
                        onTap: () {},
                        child: Container(
                          height: 18,
                          padding: EdgeInsets.symmetric(horizontal: 7),
                          decoration: BoxDecoration(
                            borderRadius: BorderRadius.all(Radius.circular(18)),
                            color: Colors.red,
                          ),
                          child: Row(
                            children: [
                              Image.asset(
                                'assets/images/found_module/found_fx.png',
                                width: 10,
                                height: 10,
                              ),
                              SizedBox(
                                width: 3,
                              ),
                              Text(
                                "10",
                                style: TextStyle(
                                    color: Color.fromRGBO(255, 255, 255, 1),
                                    fontSize: 12),
                              ),
                            ],
                          ),
                        ),
                      ),
                    ],
                  ),
                  SizedBox(
                    height: 3,
                  ),
                  Text(
                    '2021-06-07 14:30:02',
                    style: TextStyle(
                      color: Color.fromRGBO(62, 61, 72, 1),
                      fontSize: 11,
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
        Container(
          margin: EdgeInsets.only(top: 11),
          child: Text.rich(
            TextSpan(
              style: TextStyle(
                fontSize: 13,
                color: Color.fromRGBO(106, 106, 106, 1),
              ),
              text: '小型风扇迷你可充电随身携带\r\n劵后👉9.9\r\n夏日必备好物推荐✨3档风速\r\nUSB充电❤全天候清凉',
            ),
          ),
        ),
        Row(
          mainAxisAlignment: MainAxisAlignment.end,
          children: [
            Text(
              "1111种草",
              style: TextStyle(
                fontSize: 13,
                color: Color.fromRGBO(106, 106, 106, 1),
              ),
            ),
          ],
        ),
        SizedBox(
          height: 8,
        ),
        Offstage(
          offstage: true,
          child: Container(
              padding: EdgeInsets.symmetric(horizontal: 7, vertical: 7),
              decoration: BoxDecoration(
                borderRadius: BorderRadius.all(Radius.circular(8)),
                color: Color.fromRGBO(249, 249, 249, 1),
              ),
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  ClipRRect(
                    borderRadius: BorderRadius.circular(8),
                    child: Image.network(
                      'https://img.alicdn.com/bao/uploaded/i1/389649927/O1CN016KZY2H2NCcQR8JxMw_!!389649927.jpg',
                      width: 78,
                      height: 78,
                      fit: BoxFit.cover,
                    ),
                  ),
                  SizedBox(
                    width: 11,
                  ),
                  Expanded(
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Container(
                            child: Row(
                          children: [
                            Image.asset(
                              'assets/images/public_module/public_shop_icon_jd.png',
                              width: 11,
                              height: 11,
                            ),
                            SizedBox(
                              width: 5,
                            ),
                            Expanded(
                              child: Text(
                                "A4塑封膜10丝透明照片a4过塑膜7A4塑封膜10丝透明照片a4过塑膜",
                                style: TextStyle(
                                  fontSize: 12,
                                  color: Color.fromRGBO(62, 61, 72, 1),
                                ),
                                overflow: TextOverflow.ellipsis,
                                maxLines: 1,
                              ),
                            )
                          ],
                        )),
                        SizedBox(
                          height: 8,
                        ),
                        Container(
                          padding: EdgeInsets.symmetric(vertical: 4),
                          decoration: BoxDecoration(
                            borderRadius: BorderRadius.all(Radius.circular(8)),
                            color: Colors.white,
                          ),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Expanded(
                                  child: Column(
                                children: [
                                  Text.rich(
                                    TextSpan(
                                      children: [
                                        TextSpan(
                                          text: "￥",
                                          style: TextStyle(
                                            fontSize: 13,
                                            color:
                                                Color.fromRGBO(255, 37, 38, 1),
                                          ),
                                        ),
                                        TextSpan(
                                          text: "19.9",
                                          style: TextStyle(
                                            fontSize: 14,
                                            fontWeight: FontWeight.bold,
                                            color:
                                                Color.fromRGBO(255, 37, 38, 1),
                                          ),
                                        ),
                                      ],
                                    ),
                                  ),
                                  Text(
                                    "到手价",
                                    style: TextStyle(
                                      fontSize: 10,
                                      color: Color.fromRGBO(62, 61, 72, 1),
                                    ),
                                  ),
                                ],
                              )),
                              Expanded(
                                  child: Column(
                                children: [
                                  Text.rich(
                                    TextSpan(
                                      children: [
                                        TextSpan(
                                          text: "￥",
                                          style: TextStyle(
                                            fontSize: 13,
                                            color:
                                                Color.fromRGBO(255, 37, 38, 1),
                                          ),
                                        ),
                                        TextSpan(
                                          text: "1.9",
                                          style: TextStyle(
                                            fontSize: 14,
                                            fontWeight: FontWeight.bold,
                                            color:
                                                Color.fromRGBO(255, 37, 38, 1),
                                          ),
                                        ),
                                      ],
                                    ),
                                  ),
                                  Text(
                                    "预估收益",
                                    style: TextStyle(
                                      fontSize: 10,
                                      color: Color.fromRGBO(62, 61, 72, 1),
                                    ),
                                  ),
                                ],
                              )),
                              GestureDetector(
                                onTap: () {},
                                child: Image.asset(
                                    "assets/images/found_module/found_ljgm.png",
                                    height: 45),
                              ),
                            ],
                          ),
                        )
                      ],
                    ),
                  ),
                ],
              )),
        ),
        SizedBox(
          height: 15,
        ),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Expanded(
                child: _leftBottom(
              "assets/images/found_module/found_bc.png",
              "保存图片",
            )),
            Container(
              width: 0.5,
              height: 1,
              color: Color.fromRGBO(226, 226, 226, 1),
            ),
            Expanded(
                child: _leftBottom(
              "assets/images/found_module/found_fzwa.png",
              "复制文案",
            )),
            Container(
              width: 0.5,
              height: 1,
              color: Color.fromRGBO(226, 226, 226, 1),
            ),
            Expanded(
                child: _leftBottom(
              "assets/images/found_module/found_yjfq.png",
              "一键发圈",
            )),
          ],
        )
      ],
    ),
  );
}
